package org.wattdepot.cli;

import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Test;

/**
 * Testing to make sure the summaries are accurate.
 * @author wing
 *
 */
public class TestSrcSummary {

  /**
   * Insert sample values for the Source Summary command.
   * @throws Exception if anything goes wrong.
   */
  @Test
  public void testSrcSummary() throws Exception {

    Map<String, WattDepotCliCommand> commandMap = new HashMap<String, WattDepotCliCommand>();
    commandMap.put("summary", new ListSrcSummary());
    List<String> sampleString =  new ArrayList<String>();
    sampleString.add(0,"SIM_OAHU_GRID");
    WattDepotCliCommand sampleCommand = commandMap.get("summary");
    String result = sampleCommand.doCommand(sampleString); 

    assertTrue("summary of source", result.contains("SIM_KAHE, SIM_WAIAU, SIM_HONOLULU, SIM_IPP"));
    assertTrue("summary 1", result.contains("Owner: oscar@wattdepot.org"));
    assertTrue("summary 2", result.contains("Location: To be looked up later"));
    assertTrue("summary 3", result.contains("Coordinates: 0,0,0"));
    assertTrue("summary 4", result.contains("Earliest Data: 2009-10-25T00:00:00.000-10:00"));
    assertTrue("summary 5", result.contains("Latest Data: 2009-12-31T23:45:00.000-10:00"));
  }
  
}


